package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author XIN
 * 2023/4/20
 */
@RestController
@RequestMapping("/admin/product")
public class FileUploadController {
	
	@Autowired
	private FileUploadService fileUpload;
	/**
	 * 文件上传管理
	 * @param file
	 * @return
	 */
	@PostMapping("/fileUpload")
	public Result fileUpload(MultipartFile file) {
		String url = fileUpload.fileUpload(file);
		return Result.ok(url);
	}
	
	
	
}
